<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // var num1 = 55;
        // var num2 = 66;
        // function f1(num, num1) {
        //     num = 100;
        //     num1 = 100;
        //     num2 = 100;
        //     console.log(num); //100
        //     console.log(num1); //100
        //     console.log(num2); //100
        // }
        // f1(num1, num2);
        // console.log(num1); //55
        // console.log(num2);//100

        var a = 10;
        var b = 20;
        function add(a, b) {
            a = 30;// 局部的
            return a + b;
        }
        add(a, b);
        console.log(a);// 10

        function f1(arr) {// 局部的arr
            for (var i = 0; i < arr.length; i++) {
                arr[i] += 2
            }
            console.log(arr);
        }
        var arr;
        arr = [1, 2];
        f1(arr);

        console.log(arr);
    </script>
</body>

</html>